package cn.dnui_cr503.dnuifood_16110100503.model;

import cn.dnui_cr503.dnuifood_16110100503.iface.Foodiface;
import cn.dnui_cr503.dnuifood_16110100503.listener.OnRetrofitListener;
import cn.dnui_cr503.dnuifood_16110100503.service.FoodService;
import retrofit2.Call;

/**
 * Created by chengrui on 2018/11/16.
 */

public class FoodModel extends BaseModel implements Foodiface{
    private FoodService service;

    public FoodModel(){
        super();
        service = retrofit.create(FoodService.class);
    }
    @Override
    public void getFoodByShop(String shop_id, OnRetrofitListener listener) {
        Call call =service.getFoodByShop(shop_id);
        bindCallback(call,listener,1);
    }
    @Override
    public void getFoodById(String food_id, OnRetrofitListener listener) {
        Call call = service.getFoodById(food_id);
        bindCallback(call,listener,2);
    }
    @Override
    public void getAllCommentsByFood(String food_id, OnRetrofitListener listener) {
        Call call = service.getAllCommentsByFood(food_id);
        bindCallback(call,listener,3);
    }
}
